<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* .box {
      width: 200px;
      height: 200px;
      border: 3px solid #000;
      font-size: 30px;
      margin-top: 10px;
    }
    .pink {
      background-color: pink;
    }
    .big {
      width: 300px;
      height: 300px;
    } */
  </style>
</head>

<body>

  <div id="app">
    <!-- <div class="box">黑马程序员</div>
    <div class="box">黑马程序员</div> -->
    <input type="text" v-model.number="num1">
    <select name="aa" v-model.number="aa">
      <option value="*">*</option>
      <option value="/">/</option>
      <option value="+">+</option>
      <option value="-">-</option>
    </select>
    <input type="text" v-model="num2">
    <hr>
    <p>{{fn}}</p> 
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        aa: '',
        num1: '',
        num2: ''
      },
      computed: {
        fn() {
          //谨防注入
          //eval()将字符串转为代码执行
          return eval(this.num1 + this.aa + this.num2)
        }
      }
    })
  </script>
</body>

</html>